<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 18] 18.60 java.awt.Toolkit (JDK 1.0)</TITLE>
<META NAME="author" CONTENT="David Flanagan">
<META NAME="date" CONTENT="Thu Jul 31 16:11:12 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java in a Nutshell">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java in a Nutshell" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch18_59.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 18<br>The java.awt Package</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch18_61.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=sect1>
<h2 CLASS=sect1><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-60">18.60 java.awt.Toolkit (JDK 1.0)</A></h2>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-60.1"></A></h3>
</DIV>

<P CLASS=para>
This abstract class defines methods that, when implemented,
create platform-dependent "peers" for each of the
<tt CLASS=literal>java.awt</tt> <tt CLASS=literal>Component</tt> types.  Java supports its
platform-independent GUI interface by implementing a
subclass of <tt CLASS=literal>Toolkit</tt> for each platform.  Portable
programs should never use these methods to create
peers directly--they should use the <tt CLASS=literal>Component</tt>
classes themselves.  A <tt CLASS=literal>Toolkit</tt> object cannot be
instantiated directly.  <tt CLASS=literal>Component.getToolkit()</tt> returns
the <tt CLASS=literal>Toolkit</tt> being used for a particular
component.

<P CLASS=para>
The <tt CLASS=literal>Toolkit</tt> class defines a few methods that you can
use directly: the static method <tt CLASS=literal>getDefaultToolkit()</tt>
returns the default <tt CLASS=literal>Toolkit</tt> that is in use.
<tt CLASS=literal>getScreenSize()</tt> returns the screen size in pixels,
and <tt CLASS=literal>getScreenResolution()</tt> returns the resolution in
dots-per-inch.  <tt CLASS=literal>getFontList()</tt> returns the names of
supported fonts.  <tt CLASS=literal>sync()</tt> flushes
all pending graphics output, which can be useful for
animation.
In Java 1.1, <tt CLASS=literal>getPrintJob()</tt>,
<tt CLASS=literal>getSystemClipboard()</tt>, and
<tt CLASS=literal>getSystemEventQueue()</tt> are also of interest.

<DIV CLASS=screen>
<P>
<PRE>
public abstract class <tt CLASS=literal>Toolkit</tt> extends Object {
    // <tt CLASS=literal>Default Constructor: public Toolkit()</tt>
    // <tt CLASS=literal>Class Methods</tt>
            public static synchronized Toolkit <tt CLASS=literal>getDefaultToolkit</tt>();
        <b>1.1</b>  protected static Container <tt CLASS=literal>getNativeContainer</tt>(Component <tt CLASS=literal>c</tt>);
        <b>1.1</b>  public static String <tt CLASS=literal>getProperty</tt>(String <tt CLASS=literal>key</tt>, String <tt CLASS=literal>defaultValue</tt>);
    // <tt CLASS=literal>Public Instance Methods</tt>
        <b>1.1</b>  public abstract void <tt CLASS=literal>beep</tt>();
            public abstract int <tt CLASS=literal>checkImage</tt>(Image <tt CLASS=literal>image</tt>, int <tt CLASS=literal>width</tt>, int <tt CLASS=literal>height</tt>, ImageObserver <tt CLASS=literal>observer</tt>);
            public abstract Image <tt CLASS=literal>createImage</tt>(ImageProducer <tt CLASS=literal>producer</tt>);
        <b>1.1</b>  public Image <tt CLASS=literal>createImage</tt>(byte[] <tt CLASS=literal>imagedata</tt>);
        <b>1.1</b>  public abstract Image <tt CLASS=literal>createImage</tt>(byte[] <tt CLASS=literal>imagedata</tt>, int <tt CLASS=literal>imageoffset</tt>, int <tt CLASS=literal>imagelength</tt>);
            public abstract ColorModel <tt CLASS=literal>getColorModel</tt>();
            public abstract String[] <tt CLASS=literal>getFontList</tt>();
            public abstract FontMetrics <tt CLASS=literal>getFontMetrics</tt>(Font <tt CLASS=literal>font</tt>);
            public abstract Image <tt CLASS=literal>getImage</tt>(String <tt CLASS=literal>filename</tt>);
            public abstract Image <tt CLASS=literal>getImage</tt>(URL <tt CLASS=literal>url</tt>);
        <b>1.1</b>  public int <tt CLASS=literal>getMenuShortcutKeyMask</tt>();
        <b>1.1</b>  public abstract PrintJob <tt CLASS=literal>getPrintJob</tt>(Frame <tt CLASS=literal>frame</tt>, String <tt CLASS=literal>jobtitle</tt>, Properties <tt CLASS=literal>props</tt>);
            public abstract int <tt CLASS=literal>getScreenResolution</tt>();
            public abstract Dimension <tt CLASS=literal>getScreenSize</tt>();
        <b>1.1</b>  public abstract Clipboard <tt CLASS=literal>getSystemClipboard</tt>();
        <b>1.1</b>  public final EventQueue <tt CLASS=literal>getSystemEventQueue</tt>();
            public abstract boolean <tt CLASS=literal>prepareImage</tt>(Image <tt CLASS=literal>image</tt>, int <tt CLASS=literal>width</tt>, int <tt CLASS=literal>height</tt>, ImageObserver <tt CLASS=literal>observer</tt>);
            public abstract void <tt CLASS=literal>sync</tt>();
    // <tt CLASS=literal>Protected Instance Methods</tt>
            protected abstract ButtonPeer <tt CLASS=literal>createButton</tt>(Button <tt CLASS=literal>target</tt>);
            protected abstract CanvasPeer <tt CLASS=literal>createCanvas</tt>(Canvas <tt CLASS=literal>target</tt>);
            protected abstract CheckboxPeer <tt CLASS=literal>createCheckbox</tt>(Checkbox <tt CLASS=literal>target</tt>);
            protected abstract CheckboxMenuItemPeer <tt CLASS=literal>createCheckboxMenuItem</tt>(CheckboxMenuItem <tt CLASS=literal>target</tt>);
            protected abstract ChoicePeer <tt CLASS=literal>createChoice</tt>(Choice <tt CLASS=literal>target</tt>);
        <b>1.1</b>  protected LightweightPeer <tt CLASS=literal>createComponent</tt>(Component <tt CLASS=literal>target</tt>);
            protected abstract DialogPeer <tt CLASS=literal>createDialog</tt>(Dialog <tt CLASS=literal>target</tt>);
            protected abstract FileDialogPeer <tt CLASS=literal>createFileDialog</tt>(FileDialog <tt CLASS=literal>target</tt>);
            protected abstract FramePeer <tt CLASS=literal>createFrame</tt>(Frame <tt CLASS=literal>target</tt>);
            protected abstract LabelPeer <tt CLASS=literal>createLabel</tt>(Label <tt CLASS=literal>target</tt>);
            protected abstract ListPeer <tt CLASS=literal>createList</tt>(List <tt CLASS=literal>target</tt>);
            protected abstract MenuPeer <tt CLASS=literal>createMenu</tt>(Menu <tt CLASS=literal>target</tt>);
            protected abstract MenuBarPeer <tt CLASS=literal>createMenuBar</tt>(MenuBar <tt CLASS=literal>target</tt>);
            protected abstract MenuItemPeer <tt CLASS=literal>createMenuItem</tt>(MenuItem <tt CLASS=literal>target</tt>);
            protected abstract PanelPeer <tt CLASS=literal>createPanel</tt>(Panel <tt CLASS=literal>target</tt>);
        <b>1.1</b>  protected abstract PopupMenuPeer <tt CLASS=literal>createPopupMenu</tt>(PopupMenu <tt CLASS=literal>target</tt>);
        <b>1.1</b>  protected abstract ScrollPanePeer <tt CLASS=literal>createScrollPane</tt>(ScrollPane <tt CLASS=literal>target</tt>);
            protected abstract ScrollbarPeer <tt CLASS=literal>createScrollbar</tt>(Scrollbar <tt CLASS=literal>target</tt>);
            protected abstract TextAreaPeer <tt CLASS=literal>createTextArea</tt>(TextArea <tt CLASS=literal>target</tt>);
            protected abstract TextFieldPeer <tt CLASS=literal>createTextField</tt>(TextField <tt CLASS=literal>target</tt>);
            protected abstract WindowPeer <tt CLASS=literal>createWindow</tt>(Window <tt CLASS=literal>target</tt>);
        <b>1.1</b>  protected abstract FontPeer <tt CLASS=literal>getFontPeer</tt>(String <tt CLASS=literal>name</tt>, int <tt CLASS=literal>style</tt>);
        <b>1.1</b>  protected abstract EventQueue <tt CLASS=literal>getSystemEventQueueImpl</tt>();
        <b>1.1</b>  protected void <tt CLASS=literal>loadSystemColors</tt>(int[] <tt CLASS=literal>systemColors</tt>);
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-18-SECT-60.2">Returned By:</A></h3>

<P CLASS=para>
<tt CLASS=literal>Component.getToolkit(), 
ComponentPeer.getToolkit(), 
Toolkit.getDefaultToolkit(), 
Window.getToolkit()</tt>

</DIV>

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch18_59.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch18_61.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>java.awt.TextField (JDK 1.0)</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>java.awt.Window (JDK 1.0)</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
